from deploy.remote.monitor import MonitoredService 
from deploy.remote.monitor import ServiceStatus
import unittest


class TestMonitoredService(unittest.TestCase):

    SERVICE_NAME = 'TheService'
    SERVICE_HOST = 'ServiceHost'

    def setUp(self):
        self.service = MonitoredService(name = TestMonitoredService.SERVICE_NAME,
                                        host = TestMonitoredService.SERVICE_HOST)

    def test_init(self):
        self.failUnlessEqual(self.service.name, TestMonitoredService.SERVICE_NAME)
        self.failUnlessEqual(self.service.host, TestMonitoredService.SERVICE_HOST)
        
        self.failIf(self.service._MonitoredService__nextCheck is None, self.service._MonitoredService__nextCheck)
        self.failUnless(self.service._MonitoredService__lastStatus is None, self.service._MonitoredService__lastStatus)
        
    def test_status(self):
        self.failUnlessEqual(self.service.status, ServiceStatus.UNKNOWN)

    def test_checkStatus_returnsUnknown(self):
        self.failUnlessEqual(self.service.checkStatus(), ServiceStatus.UNKNOWN)